package com.huirui.server.pojo.dto;

import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.util.List;

@Data
public class ShippingCartListDto {


    @NotNull(message = "商品ID不能为空")
    private Long productId;

    @NotEmpty(message = "购物车规格列表不能为空")
    @Valid // 关键：触发嵌套对象（ShippingCartAnotherDto）的校验
    private List<ShippingCartAnotherDto> shippingCartDtoList;

    @Data
    public static class ShippingCartAnotherDto {



        @NotNull(message = "规格ID不能为空")
        private Long productSpecificationId;

        @NotNull(message = "商品数量不能为空")
        @Min(value = 1, message = "商品数量至少为1")
        private Long quantity;
    }
}